package com.lifang.framework.aop.framework;

import com.lifang.framework.aop.TargetSource;
import com.lifang.framework.beans.factory.BeanFactory;

public class SingletonTargetSource implements TargetSource {

    private final Object beanInstance;
    private final String beanName;
    private final BeanFactory beanFactory;

    public SingletonTargetSource(Object beanInstance, String beanName, BeanFactory beanFactory) {
        this.beanInstance = beanInstance;
        this.beanName = beanName;
        this.beanFactory = beanFactory;
    }

    @Override
    public Class<?> getTargetClass() {
        return beanInstance.getClass();
    }

    @Override
    public Object getTarget() throws Exception {
        return this.beanInstance;
    }

    @Override
    public boolean isStatic() {
        return false;
    }
}
